/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <gtest/gtest.h>
#include "sle_announce_interface.h"
#include "kh_sle_announce.h"
#include "cmd_input.h"
#include <vector>
#include <memory>
#include <cstring>
#include <iterator>
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <sys/socket.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <memory>
#include <functional>

namespace OHOS {
namespace NearLink {
namespace SleStandard {
namespace {
using namespace testing::ext;
static uint8_t g_announceId = 255;
} // namespace

class AnnounceHandlerTest : public testing::Test {
public:
    static void SetUpTestCase();
    static void TearDownTestCase();
    void SetUp();
    void TearDown();
};

void AnnounceHandlerTest::SetUpTestCase() {}

void AnnounceHandlerTest::TearDownTestCase() {}

void AnnounceHandlerTest::SetUp() {
    SleErrorCode ret = InitSleAnnounceService();
    printf("ret = %d", ret);
}

void AnnounceHandlerTest::TearDown() {}

HWTEST_F(AnnounceHandlerTest, AddAnnounceTest, TestSize.Level1)
{
    SleErrorCode ret = AddAnnounce(&g_announceId);
    EXPECT_EQ(ret, SLE_ERR_CHECKOUT_FAILED);
}

HWTEST_F(AnnounceHandlerTest, RemoveAnnounceTest, TestSize.Level1)
{
    SleErrorCode ret = RemoveAnnounce(g_announceId);
    EXPECT_EQ(ret, SLE_ERR_INVALID_PARAM);
}

HWTEST_F(AnnounceHandlerTest, StartAnnounceTest, TestSize.Level1)
{
    char announceData[200] = {'k','h','_','s','l','e','_','t','o','o','l','_','d','a','t','a',':', '\0'};
    char responceData[200] = {'k','h','_','s','l','e','_','t','o','o','l','_','r','e','s','p',':', '\0'};
    SleAnnounceData data = {
        .announceLength = strlen(announceData),
        .announceData = (uint8_t*)announceData,
        .responceLength = strlen(responceData),
        .responceData = (uint8_t*)responceData,
    };
    SleErrorCode ret = StartAnnounce(g_announceId, &data, NULL);
    EXPECT_EQ(ret, SLE_ERR_INVALID_PARAM);
}

HWTEST_F(AnnounceHandlerTest, StopAnnounceTest, TestSize.Level1)
{
    SleErrorCode ret = StopAnnounce(g_announceId);
    EXPECT_EQ(ret, SLE_ERR_INVALID_PARAM);
}
}
} // namespace NetManagerStandard
} // namespace OHOS